const {
  override,
  addWebpackAlias,
  overrideDevServer,
  watchAll,
} = require("customize-cra");
const path = require("path");

console.log("=================base_url========");
console.log(process.env.REACT_APP_BASE_URL);
console.log("=================base_url========");

module.exports = {
  devServer: overrideDevServer((config) => {
    return {
      ...config,
      proxy: {
        "/api": {
          target: process.env.REACT_APP_BASE_URL,
          pathRewrite: { "/api": "" },
          changeOrigin: true,
        },
      },
    };
  }, watchAll()),
  webpack: override(
    addWebpackAlias({
      "@": path.resolve(__dirname, "src"),
      "@/components": path.resolve(__dirname, "src/components"),
    })
  )
};
